#
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
#

SET_FLAGS_FOR("GEN8" "BDW")
SET_FLAGS_FOR("GEN9" "SKL" "KBL" "BXT" "GLK" "CFL")
SET_FLAGS_FOR("GEN11" "ICLLP" "LKF" "EHL")
SET_FLAGS_FOR("GEN12LP" "TGLLP" "RKL" "ADLS")

# Add supported and tested platforms
if(SUPPORT_GEN8)
  set(CORE_GEN8_REVISIONS 0)
  if(TESTS_GEN8)
    ADD_ITEM_FOR_GEN("FAMILY_NAME" "TESTED" "GEN8" "BDWFamily")
  endif()
  if(SUPPORT_BDW)
    ADD_PRODUCT("SUPPORTED" "BDW" "IGFX_BROADWELL")
    ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN8" "BDW" "CORE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_2_0" "GEN8" "BDW" "CORE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_IMAGES" "GEN8" "BDW" "CORE")
    if(TESTS_BDW)
      ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN8" "BDW")
      ADD_PRODUCT("TESTED" "BDW" "IGFX_BROADWELL")
    endif()
  endif()
endif()

if(SUPPORT_GEN9)
  set(CORE_GEN9_REVISIONS 9)
  set(LP_GEN9_REVISIONS 0)
  if(TESTS_GEN9)
    ADD_ITEM_FOR_GEN("FAMILY_NAME" "TESTED" "GEN9" "SKLFamily")
  endif()
  if(SUPPORT_SKL)
    ADD_PRODUCT("SUPPORTED" "SKL" "IGFX_SKYLAKE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN9" "SKL" "CORE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_2_0" "GEN9" "SKL" "CORE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_VME" "GEN9" "SKL" "CORE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_IMAGES" "GEN9" "SKL" "CORE")
    set(PREFERRED_PLATFORM "SKL")
    if(TESTS_SKL)
      set(PREFERRED_FAMILY_NAME "SKLFamily")
      ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN9" "SKL")
      ADD_PRODUCT("TESTED" "SKL" "IGFX_SKYLAKE")
    endif()
  endif()

  if(SUPPORT_KBL)
    ADD_PRODUCT("SUPPORTED" "KBL" "IGFX_KABYLAKE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN9" "KBL" "CORE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_2_0" "GEN9" "KBL" "CORE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_VME" "GEN9" "KBL" "CORE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_IMAGES" "GEN9" "KBL" "CORE")
    if(TESTS_KBL)
      ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN9" "KBL")
      ADD_PRODUCT("TESTED" "KBL" "IGFX_KABYLAKE")
    endif()
  endif()

  if(SUPPORT_GLK)
    ADD_PRODUCT("SUPPORTED" "GLK" "IGFX_GEMINILAKE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN9" "GLK" "LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_VME" "GEN9" "GLK" "LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_IMAGES" "GEN9" "GLK" "LP")
    if(TESTS_GLK)
      ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN9" "GLK")
      ADD_PRODUCT("TESTED" "GLK" "IGFX_GEMINILAKE")
    endif()
  endif()

  if(SUPPORT_CFL)
    ADD_PRODUCT("SUPPORTED" "CFL" "IGFX_COFFEELAKE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN9" "CFL" "CORE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_2_0" "GEN9" "CFL" "CORE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_VME" "GEN9" "CFL" "CORE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_IMAGES" "GEN9" "CFL" "CORE")
    if(TESTS_CFL)
      ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN9" "CFL")
      ADD_PRODUCT("TESTED" "CFL" "IGFX_COFFEELAKE")
    endif()
  endif()

  if(SUPPORT_BXT)
    ADD_PRODUCT("SUPPORTED" "BXT" "IGFX_BROXTON")
    ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN9" "BXT" "LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_VME" "GEN9" "BXT" "LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_IMAGES" "GEN9" "BXT" "LP")
    if(TESTS_BXT)
      ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN9" "BXT")
      ADD_PRODUCT("TESTED" "BXT" "IGFX_BROXTON")
    endif()
  endif()
endif()

if(SUPPORT_GEN11)
  set(CORE_GEN11_REVISIONS 0)
  set(LP_GEN11_REVISIONS 0)
  if(TESTS_GEN11)
    ADD_ITEM_FOR_GEN("FAMILY_NAME" "TESTED" "GEN11" "ICLFamily")
  endif()

  if(SUPPORT_ICLLP)
    ADD_PRODUCT("SUPPORTED" "ICLLP" "IGFX_ICELAKE_LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN11" "ICLLP" "LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_2_0" "GEN11" "ICLLP" "LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_VME" "GEN11" "ICLLP" "LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_IMAGES" "GEN11" "ICLLP" "LP")
    if(TESTS_ICLLP)
      ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN11" "ICLLP")
      ADD_PRODUCT("TESTED" "ICLLP" "IGFX_ICELAKE_LP")
    endif()
  endif()

  if(SUPPORT_LKF)
    ADD_PRODUCT("SUPPORTED" "LKF" "IGFX_LAKEFIELD")
    ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN11" "LKF" "LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_IMAGES" "GEN11" "LKF" "LP")
    if(TESTS_LKF)
      ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN11" "LKF")
      ADD_PRODUCT("TESTED" "LKF" "IGFX_LAKEFIELD")
    endif()
  endif()

  if(SUPPORT_EHL)
    ADD_PRODUCT("SUPPORTED" "EHL" "IGFX_ELKHARTLAKE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN11" "EHL" "LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_IMAGES" "GEN11" "EHL" "LP")
    if(TESTS_EHL)
      ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN11" "EHL")
      ADD_PRODUCT("TESTED" "EHL" "IGFX_ELKHARTLAKE")
    endif()
  endif()
endif()

if(SUPPORT_GEN12LP)
  set(LP_GEN12LP_REVISIONS 0)
  if(TESTS_GEN12LP)
    ADD_ITEM_FOR_GEN("FAMILY_NAME" "TESTED" "GEN12LP" "TGLLPFamily")
  endif()
  if(SUPPORT_TGLLP)
    ADD_PRODUCT("SUPPORTED" "TGLLP" "IGFX_TIGERLAKE_LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN12LP" "TGLLP" "LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_IMAGES" "GEN12LP" "TGLLP" "LP")
    if(TESTS_TGLLP)
      ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN12LP" "TGLLP")
      ADD_PRODUCT("TESTED" "TGLLP" "IGFX_TIGERLAKE_LP")
    endif()
  endif()

  if(SUPPORT_DG1)
    ADD_PRODUCT("SUPPORTED" "DG1" "IGFX_DG1")
    ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN12LP" "DG1" "LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_IMAGES" "GEN12LP" "DG1" "LP")
    if(TESTS_DG1)
      ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN12LP" "DG1")
      ADD_PRODUCT("TESTED" "DG1" "IGFX_DG1")
    endif()
  endif()

  if(SUPPORT_RKL)
    ADD_PRODUCT("SUPPORTED" "RKL" "IGFX_ROCKETLAKE")
    ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN12LP" "RKL" "LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_IMAGES" "GEN12LP" "RKL" "LP")
    if(TESTS_RKL)
      ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN12LP" "RKL")
      ADD_PRODUCT("TESTED" "RKL" "IGFX_ROCKETLAKE")
    endif()
  endif()

  if(SUPPORT_ADLS)
    ADD_PRODUCT("SUPPORTED" "ADLS" "IGFX_ALDERLAKE_S")
    ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN12LP" "ADLS" "LP")
    ADD_PLATFORM_FOR_GEN("SUPPORTED_IMAGES" "GEN12LP" "ADLS" "LP")
    if(TESTS_ADLS)
      ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN12LP" "ADLS")
      ADD_PRODUCT("TESTED" "ADLS" "IGFX_ALDERLAKE_S")
    endif()
  endif()
endif()
